import React, { useState } from "react";
import { NavBar, Toast, Button, Cell, Image, Grid } from "react-vant";
import {
  Revoke,
  VolumeO,
  ShopO,
  Paid,
  OrdersO,
  Records,
  PlayCircleO,
  UserCircleO,
  LikeO,
  Completed,
  SettingO,
  StarO,
} from "@react-vant/icons";
import { useNavigate } from "react-router-dom";
import "./index.css";
const Index: React.FC = () => {
  const navigate = useNavigate();
  let img = JSON.parse(localStorage.getItem("info")!);
  let user = localStorage.getItem("user");
  const qd = () => {
    Toast.loading({
      message: "加载中...",
      forbidClick: true,
      loadingType: "spinner",
    });
  };
  const dqwz = () => {
    navigate("/currentconsultation");
  };
  const lswz = () => {
    navigate("/historicalconsultation");
  };

  const wdda=()=>{
    console.log("我的档案")
    navigate('/myprofile')
  }
  const wdqb=()=>{
    console.log("我的钱包") //
    navigate('/mywallet')
  }
  const wdsc=()=>{
    console.log("我的收藏")
  }
  const bsnjy=()=>{
    console.log("被采纳建议")
  }
  const wdsp=()=>{
    console.log("我的视频")
  }
  const wdgz=()=>{
    console.log("我的关注")
  }
  const wdrw=()=>{
    console.log("我的任务") //
    navigate('/mytask')
  }
  const sbgl=()=>{
    console.log("设备管理") //
    navigate("/devicemanagement")
  }
  return (
    <div>
      <NavBar
        leftText={
          <Revoke
            onPointerEnterCapture={undefined}
            onPointerLeaveCapture={undefined}
          />
        }
        rightText={
          <VolumeO
            onPointerEnterCapture={undefined}
            onPointerLeaveCapture={undefined}
          />
        }
        onClickLeft={() => navigate(-1)}
        onClickRight={() => navigate('/news')}
      />
      <div className="boxtop">
        <div className="yy">
          <img src={img} className="img" />
          {user}
        </div>
        <div className="qd">
          <Button type="primary" size="small" onClick={() => qd()}>
            签到
          </Button>
        </div>
      </div>
      <div className="wdwz">
        <div>我的问诊</div>
        <div onClick={() => dqwz()}>
          <Cell
            center
            key={0}
            title={`当前问诊`}
            icon={
              <Image
                width={44}
                height={44}
                src="https://mms1.baidu.com/it/u=94448867,1870877254&fm=253&app=138&f=PNG?w=120&h=120"
                round
              />
            }
            isLink
          />
        </div>
        <div onClick={() => lswz()}>
          <Cell
            center
            key={0}
            title={`历史问诊`}
            icon={
              <Image
                width={44}
                height={44}
                src="http://mms0.baidu.com/it/u=2400253350,3327542986&fm=253&app=138&f=JPEG?w=144&h=114"
                round
              />
            }
            isLink
          />
        </div>
      </div>
      <div className="tbk">
        <Grid>
          <Grid.Item
            icon={
              <OrdersO
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="我的档案"
            onClick={()=>wdda()}
          />

          <Grid.Item
            icon={
              <Paid
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="我的钱包"
            onClick={()=>wdqb()}
          />
          <Grid.Item
            icon={
              <StarO
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="我的收藏"
            onClick={()=>wdsc()}
          />
        </Grid>

        <Grid>
          <Grid.Item
            icon={
              <Records
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="被采纳建议"
            onClick={()=>bsnjy()}
          />

          <Grid.Item
            icon={
              <PlayCircleO
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="我的视频"
            onClick={()=>wdsp()}
          />

          <Grid.Item
            icon={
              <UserCircleO
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="我的病友圈"
          />
        </Grid>

        <Grid>
          <Grid.Item
            icon={
              <LikeO
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="我的关注"
            onClick={()=>wdgz()}
          />

          <Grid.Item
            icon={
              <Completed
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="我的任务"
            onClick={()=>wdrw()}
          />

          <Grid.Item
            icon={
              <SettingO
                onPointerEnterCapture={undefined}
                onPointerLeaveCapture={undefined}
              />
            }
            text="设置管理"
            onClick={()=>sbgl()}
          />
        </Grid>
      </div>
    </div>
  );
};

export default Index;
